﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kokomo.Environment.Services
{
	/// <summary>
	/// Represents the result of user interaction with a file dialog.
	/// </summary>
	/// <remarks>
	/// Members of <see cref="IUiService"/> return the result as an instance of this class.
	/// </remarks>
	public class FileDialogResult
	{
		/// <summary>
		/// Initializes a new instance of <see cref="FileDialogResult"/>.
		/// </summary>
		/// <param name="fileNames">The names of the files selected by the user.</param>
		public FileDialogResult(string[] fileNames)
		{
			if (fileNames == null) fileNames = new string[0];
			this.FileNames = fileNames;
		}

		/// <summary>
		/// Gets the names of the files selecetd by the user.
		/// </summary>
		public string[] FileNames { get; private set; }
		/// <summary>
		/// Gets the name of the file selected by the user.
		/// </summary>
		/// <remarks>
		/// If the user selected multiple files, this property reflects the name of the first one.
		/// </remarks>
		public string FileName
		{
			get
			{
				return (this.FileNames == null) ? null : this.FileNames.FirstOrDefault();
			}
		}
	}
}
